package server.content.quests.misc;

import server.game.players.Client;

/**
 * 
 * @author Miracle
 *
 */
public abstract class SimpleQuest {

	private final Client c;
	private final int questId;

	public SimpleQuest(final Client c, final int questId) {
		this.c = c;
		this.questId = questId;
	}

	public abstract void showInformation();

	public abstract void finishQuest();

	/**
	 * Clear all existing lines from quest interface.
	 */
	public void clearInterface() {
		for (int i = 8144; i < 8195; i++) {
			getClient().getPA().sendFrame126("", i);
		}
	}
	
	/**
	 * Sets the title for the quest interface.
	 * @param title is the title you wish to set.
	 */
	public void setInterfaceTitle(final String title) {
		getClient().getPA().sendFrame126("@dre@" + title, 8144);
		getClient().getPA().sendFrame126("", 8145);
	}
	
	public void showInterface() {
		getClient().getPA().showInterface(8134);
	}

	public void setStage(final int questStage) {
		getClient().questStages.put(getQuestId(), questStage);
	}

	public int getStage() {
		if (getClient().questStages.containsKey(getQuestId()))
			return getClient().questStages.get(getQuestId());
		return 0;
	}

	public Client getClient() {
		return c;
	}

	public int getQuestId() {
		return questId;
	}
	
}
